#include <stdio.h>

int main() {
    char num[6];
    while (1) {
        printf("请输入一个5位数(输入0退出): ");
        fgets(num, sizeof(num), stdin); 

        if (num[strlen(num)-1] == '\n') {
            num[strlen(num)-1] = '\0';
        }
        
        int c;
        while ((c = getchar()) != '\n' && c != EOF);

        if (num[0] == '0') {
            printf("程序结束。\n");
            break;
        }
        if (num[0] == num[4] && num[1] == num[3]) {
            printf("%s 是回文数\n", num);
        } else {
            printf("%s 不是回文数\n", num);
        }
    }
    
    return 0;
}
